package com.wenli.graduate2022.wenliGreenShop.controller;

import com.wenli.graduate2022.wenliGreenShop.entity.ProductImage;
import com.wenli.graduate2022.wenliGreenShop.service.servDao.ProductImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author HuangHai
 * @date 2021/10/12 23:03
 */
@RestController
public class ProductImageController {

    @Autowired
    ProductImageService productImageService;

    @GetMapping("/productImage/{productId}/{type}")
    public List<ProductImage> findByType(@PathVariable("productId") Integer productId, @PathVariable("type") Integer type){
        return productImageService.findByType(productId,type);
    }

    @GetMapping("/productImage/{productImage}")
    public List<ProductImage> findById(@PathVariable("productImage") Integer productImage){
        return productImageService.findById(productImage);
    }
}
